﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LuckyDraw.WinUI
{
	public class DrawPeople
	{
		public const string CreateTable_SQL = @"create table DrawPeople (Id real, Name varchar(20), Mobile varchar(50), Company varchar(5), CouponNo varchar(20), PrizeType1 varchar(20), PrizeType2 varchar(20), PrizeType3 varchar(20), PrizeType4 varchar(20), PrizeType5 varchar(20), Result varchar(20))";

		public const string UpdateResult_SQL = @"update DrawPeople set Result = '{0}' where CouponNo = '{1}'";

		public const string SelectPrizeType_SQL = @"select t.PrizeType1 PrizeType from (
	select PrizeType1 from DrawPeople group by PrizeType1
	union
	select PrizeType2 from DrawPeople group by PrizeType2
	union
	select PrizeType3 from DrawPeople group by PrizeType3
	union
	select PrizeType4 from DrawPeople group by PrizeType4
	union
	select PrizeType5 from DrawPeople group by PrizeType5
) t
order by t.PrizeType1";

		public double Id
		{
			get;
			set;
		}

		public string Name
		{
			get;
			set;
		}

		public string Mobile
		{
			get;
			set;
		}

		public string Company
		{
			get;
			set;
		}

		public string CouponNo
		{
			get;
			set;
		}

		public string PrizeType1
		{
			get;
			set;
		}

		public string PrizeType2
		{
			get;
			set;
		}

		public string PrizeType3
		{
			get;
			set;
		}

		public string PrizeType4
		{
			get;
			set;
		}

		public string PrizeType5
		{
			get;
			set;
		}

		public string Result
		{
			get;
			set;
		}

		public override string ToString()
		{
			return CouponNo + "  " + Name + "  " + Mobile + "  " + Result;
		}
	}
}
